<%@page import="org.smartercontext.contextmger.fixedgatherers.FacebookGatherer"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    	               "http://www.w3.org/TR/html4/loose.dtd">

<html lang="en">
 <head>
 	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Link with</title>
    <!-- Bootstrap core CSS -->
    <link rel="shortcut icon" href="Icons/scicon.png">
    <link href="http://getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="http://getbootstrap.com/examples/dashboard/dashboard.css" rel="stylesheet">

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  <style type="text/css"></style>
 </head>
   <body style="background-color: #eee;">
<%
	
		if(session.getAttribute("username")==null){
			response.sendRedirect("login.jsp?Err=3");
		}
	
	%>
    <div class="navbar navbar-inverse navbar-fixed-top" role="navigation" >
      <div class="container-fluid">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="index.jsp">
          <img src="Images/logoSmartContext_CircleH.png">
          <img src="Images/logoSmartContext_header.png"></a>
        </div>
        
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav navbar-right">
          	<li><a href="index.jsp">Home</a></li>
            <li><a href="manageContext.jsp">Manage your context</a></li>
            <li><a href="recommendations.jsp">Recommendations</a></li>
            <li class="active"><a href="linkWith.jsp">Link with...</a></li>
            <li><a href="logout.jsp">Logout</a></li>
          </ul>
          <form class="navbar-form navbar-right" action="">
            <input type="text" class="form-control" placeholder="Search...">
          </form>
        </div><!--/.nav-collapse -->
      </div>
    </div>
    
    <div class="container-fluid">
    	<div class="row">
    		<div class="col-sm-3 col-md-2 sidebar">
    			<ul class="nav nav-sidebar">
    				<li class="active"><a href="linkWith.jsp">Facebook</a></li>
    				<li><a href="linkWith_GP.jsp">Google+</a></li>
    				<li><a href="linkWith_4SQ.jsp">Foursquare</a></li>
    				<li><a href="linkWith_TW.jsp">Twitter</a></li>
    			</ul>
    		</div>
    	</div>
    </div>
    
    <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
    	<h1 class="page-header">Adding your Facebook Account</h1>
    	<h3><a href="<%=FacebookGatherer.getURLLogin()%>">Click here </a>to link your Facebook Account to SmarterContext</h3>
    	<div class="row placeholders">
    		<div style="float: left; margin-left: 5%; margin-top: 5%;">
    			<img src="Images/FBInstructions/initCalling.png">
    			<h4>Input</h4>
    			<span class="text-muted">Your Facebook credentials</span>
    		</div>
    		<div style="float: right; margin-right: 10%;">
    		   	<img src="Images/FBInstructions/initCalling3.png">
    			<h4>Accept</h4>
    			<span class="text-muted">The Facebook permissions</span>
    		</div>
    	</div>
    	<%
    	
    	if(request.getQueryString()!=null){
    		String error = request.getParameter("Error");
    		if(error.contains("access_denied")){
    			out.println("<p style=\"color:maroon\">Error: You hasn't provided the permisions</p>");
    		}else if(error.equals("1")){
    			out.println("<p style=\"color:maroon\">Error: Error acquiring the token. Try again!</p>");
    		}else if(error.equals("2")){
    			out.println("<p style=\"color:maroon\">Error: Error processing the token. Try again!</p>");
    		}
    	}
    	%>
    	<h2 class="sub-header">What permissions you are allowing to Smarter Context?</h2>
    	<div class="table-responsive">
    		<table class="table-table-striped">
    			<thead>
    				<tr>
    					<th>Nº</th>
    					<th>Name</th>
    					<th>Description</th>
    					<th>See more at</th>
    				</tr>
    			</thead>
    			<tbody>
    				<tr>
    					<td></td>
    					<td></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td></td>
    					<td><strong>User Data Permisions</strong></td>
    					<td></td>
    					<td></td>
    				</tr>
    				<tr>
    					<td>1</td>
    					<td>basic_info</td>
    					<td>It includes several elements from a person's public profile</td>
    					<td><a href="http://bit.ly/1mWPNyr" target="_blank">http://bit.ly/1mWPNyr</a></td>
    				</tr>
    				<tr>
    					<td>2</td>
    					<td>user_actions.books</td>
    					<td>Allows you to retrieve the actions published by all applications using the built-in book.writes action.</td>
    					<td><a href="http://bit.ly/1hmTrlO" target="_blank">http://bit.ly/1hmTrlO</a></td>
    				</tr>
    				<tr>
    					<td>3</td>
    					<td>user_actions.music</td>
    					<td>Allows you to retrieve the actions published by all applications using the built-in music.listens action.</td>
    					<td><a href="http://bit.ly/1hmTrlO" target="_blank">http://bit.ly/1hmTrlO</a></td>
    				</tr>
    				<tr>
    					<td>4</td>
    					<td>user_actions.video</td>
    					<td>Allows you to retrieve the actions published by all applications using the built-in video.watches action.</td>
    					<td><a href="http://bit.ly/1hmTrlO" target="_blank">http://bit.ly/1hmTrlO</a></td>
    				</tr>
    				<tr>
    					<td>5</td>
    					<td>user_birthday</td>
    					<td>Provides access to the birthday with year as the birthday property.</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>6</td>
    					<td>user_education_history</td>
    					<td>Provides access to education history as the education property</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>7</td>
    					<td>user_friends</td>
    					<td></td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>8</td>
    					<td>user_likes</td>
    					<td>Provides access to the list of all of the pages the user has liked as the likes connection</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>9</td>
    					<td>user_relationship_details</td>
    					<td>Provides access to the user's relationship preferences</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>10</td>
    					<td>user_relationships</td>
    					<td>Provides access to the user's family and personal relationships and relationship status</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    				<tr>
    					<td>11</td>
    					<td>user_work_history</td>
    					<td>Provides access to work history as the work property</td>
    					<td><a href="http://bit.ly/1fZox11" target="_blank">http://bit.ly/1fZox11</a></td>
    				</tr>
    			</tbody>
    		</table>
    	</div>
    </div>


 <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
	<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    <script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>

</body>
</html>